package com.aya.tomcat;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;
import org.junit.Test;

import javax.servlet.ServletException;

public class SimpleTomcat {

    @Test
    public void testStart() throws LifecycleException, ServletException {
        Tomcat tomcat = new Tomcat();
        tomcat.setBaseDir(".");
        String docBase = System.getProperty("user.dir") + "/src/main/webapp/";
        tomcat.addWebapp("", docBase);
        tomcat.start();
        tomcat.getServer().await();
    }
}
